home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5097 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  48 lines

  1. Path: news.dfn.de!si-nic!usenet
  2. From: Markus Becker <becker@zess.uni-siegen.de>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: *-* Help Array 640x480 *-*
  5. Date: Thu, 08 Feb 1996 11:30:13 +0100
  6. Organization: ZESS, Uni-GH-Siegen
  7. Message-ID: <3119D0B5.7727@zess.uni-siegen.de>
  8. References: <4fb7ft$cqa@acmez.gatech.edu>
  9. NNTP-Posting-Host: becker.zess.uni-siegen.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
  14.  
  15. Israel Denis Jr. wrote:
  16.  
  17. >         me create arrays that are this big. I have seen several
  18. >         of the previous post on topics relating to arrays and
  19. >         none have answered the question of how to declare an
  20. >         array of 640x480 of unsigned char. i
  21. >         I know that this could be implemented with pointers
  22. >         but I need to do this specifically with an array.
  23.  
  24. Ok, I'll try it:
  25.  
  26. 1) declate an array of pointers to char:
  27.  
  28. char *Pixarray[640];
  29.  
  30. 2) for each entry in *Pixarray allocate a coloumn of chars
  31.  
  32. Pixarray[i] = (char*)malloc(sizof(char)*480);
  33.  
  34. 3) then you can access it the following way:
  35.  
  36. Pixarray[x][y] = ObtainPixel(x,y);
  37.  
  38. Hope it works and has helped you.
  39.  
  40. Markus
  41.  
  42. --
  43. Markus Becker                
  44. http://www.zess.uni-siegen.de/private/becker/
  45. Zentrum fuer Sensorsysteme (ZESS)
  46. http://www.zess.uni-siegen.de/private/becker/win95
  47.